package reflectx

import (
	"gitee.com/zhongguo168a/gocodes/datax/schemax"
)

type ClassTypeRef struct {
}

func (f *ClassTypeRef) RefHas(field string) bool {
	switch field {
	case "Decl":
		return true
	}
	return false
}

func (f *ClassTypeRef) RefGet(target IRefObject, ClassType string) (val interface{}, isNil bool) {
	obj := target.(*schemax.ClassType)

	switch ClassType {
	case "Decl":
		return obj.Decl, false
	}
	return nil, true
}

func (f *ClassTypeRef) RefSet(target IRefObject, ClassType string, val interface{}) {
	obj := target.(*schemax.ClassType)
	switch ClassType {
	case "Decl":
		obj.Decl = val.(string)
	}
	return
}

func (f *ClassTypeRef) RefNew() IRefObject {
	return &schemax.ClassType{}
}

func (f *ClassTypeRef) RefType() string {
	return "class"
}
